
import axios from 'axios';
// 创建 axios 实例
const service = axios.create({
    // baseURL: baseUrl, // api base_url
    timeout: 60000,// 请求超时时间
    withCredentials: true,
    // headers: { 'Authorization': 'foobar' }
})

const err = async (error) => {
    console.log("请求Core发生错误=>", JSON.stringify(error))
    return Promise.reject(error)
}
// request interceptor
service.interceptors.request.use(async config => {
    // console.log("请求Core", { url: config.url, data })
    return config
}, err)
// response interceptor
service.interceptors.response.use(async response => {
    // console.log("请求Core的返回=>", response.data)
    return response.data
}, err)

export { service as axios }